<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <title>Title</title>
</head>

<body>

<table border="1" width="300px">
    <tr><td>1</td><td>2</td><td>3</td></tr>
    <tr><td>1</td><td>2</td><td>3</td></tr>
    <tr><td>1</td><td>2</td><td>3</td></tr>
    <tr><td>1</td><td>2</td><td>3</td></tr>
</table>

<script>
    var myTrs = document.getElementsByTagName('tr');
    for(var i =0;i<myTrs.length;i++){
        myTrs[i].onmousemove = function () {
            this.style.backgroundColor = "red";   //this  谁调用函数就代指谁；由于作用域问题，不能使用myTrs[i]，而使用this
        };

        myTrs[i].onmouseout = function () {
            this.style.backgroundColor = "";
        } ;

    }


</script>

</body>
</html>